var arr=[1,2,3,4,5,6,7,8,9]
var sum=[]
for(var i=0;i<Math.ceil(arr.length/3);i++){
    let item=arr.slice(i*3,(i+1)*3)
    sum.push(item)
}
console.log(sum)